﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="LiXiangEdit.aspx.cs" Inherits="PropertyAppraisal.ProjectInitiation.LiXiangEdit" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <link rel="stylesheet" type="text/css" href="../easyui/easyui/1.3.2/themes/default/easyui.css" />
    <link rel="stylesheet" type="text/css" href="../easyui/css/wu.css" />
    <link rel="stylesheet" type="text/css" href="../easyui/css/icon.css" />


    <script>
        //获取项目号
        var projectNumber = $.query.get("ke");
        
        $(function () {
            $.ajax({
                type: "post", //要用post方式                 
                url: "LiXiangEdit.aspx/Edit",//方法所在页面和方法名
                data: "{'projectNumber':'" + projectNumber + "'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (data) {
                    var json = eval("(" + data.d + ")");
                    $("#name").val(json.loan_Name);   //借款人姓名
                    $("#idCard").val(json.loan_IdCard);//借款人身份证号
                    $("#telNumber").val(json.loan_TEL);//借款人电话
                    $("#linkmen").val(json.loan_Contacts);//联系人
                    $("#linknumber").val(json.loan_ContactsTEL);  //联系人的联系方式
                    $("#overyears").val(json.surplus_Years);//剩余年限
                    $("#Quota").val(json.basic_Quota);//借款额度
                    $("#houseaddr").val(json.house_Located);//房屋位于
                    $("#select1").combobox('select', json.house_Purpose);//房屋用途
                    $("#startyear").val(json.house_Time);//房屋年代
                    $("#select22").combobox('select', json.yers_Source);//建成年代来源
                    $("#select3").combobox('select', json.presentation_Type);//报告类型

                    //评估受理复选框反填
                    $(":checkbox").each(function () {
                        var tmpVal = $(this).val();
                        if (json.assessment.indexOf(tmpVal) >= 0) {
                            $(this).attr("checked", true);
                        }
                    })

                    $("#select4").combobox('select', json.the_Department);//所属部门
                    $("#select5").combobox('select', json.survey);//勘察员
                    $("#select6").combobox('select', json.evaluation);//评估员
                    $("#riqi").val(json.issue_Time);//出具日期
                }
            });
            //更改评估员
            $("#UpdateEvaluation").bind('click', function () {

                var state = $.query.get("state");
                alert(state)
                var select6 = $("#select6").combobox("getValue");
                var select5 = $("#select5").combobox("getValue");
                var select4 = $("#select4").combobox("getValue");
                $.ajax({
                    type: "post",
                    url: "LiXiangEdit.aspx/UpdateEvaluation",
                    data: "{'projectNumber':'" + projectNumber + "','ID':'" + select6 + "','Bumen':'" + select4 + "','Kancha':'" + select5 + "','State':'" + state + "'}",
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    async: false,
                    success: function (obj) {
                        obj = eval(obj)
                        if (obj) {
                            $.messager.alert('变更信息', '评估员变更成功', 'info', function () {
                                parent.addTab("项目立项列表", "/ProjectInitiation/LiXiangList.aspx", "icon-chart-organisation", true);
                            });
                        }
                        else {
                            $.messager.alert('变更信息', '评估员变更失败');
                        }
                    }
                })
            })
        })
    </script>
</head>
<body>
    <form id="form1" runat="server">
            <iframe width="0" height="0" src="../SessionKeeper.aspx"></iframe>   
        <div>
            <div class="easyui-panel" fit="true">
                <div style="margin-left: 30px;" id="ff">
                    <div>
                        <span>借款人员基本信息：</span>
                    </div>
                    <div style="padding: 10px 0 10px 100px">
                        <table>
                            <tbody id="tbtb">
                                <tr>
                                    <td><span>借款人员姓名：</span><input disabled="disabled" class="easyui-validatebox a" type="text" id="name" data-options="required:true" /></td>
                                    <td><span>身份证号：</span><input disabled="disabled" class="easyui-validatebox b" type="text" id="idCard" data-options="required:true" /></td>
                                    <td><span>联系电话：</span><input disabled="disabled" class="easyui-validatebox c" type="text" id="telNumber" data-options="required:true" /></td>
                                    <td><a href="#" class="easyui-linkbutton" style="display: none" data-options="iconCls:'icon-add',toggle:true" onclick="add()">添加借款人</a></td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                    <div>
                        <table>
                            <tr>
                                <td>联系人：</td>
                                <td style="padding-left: 50px;">
                                    <input disabled="disabled" class="easyui-validatebox" type="text" id="linkmen" data-options="required:true" style="width: 800px;" placeholder="请输入联系人" /></td>
                            </tr>
                            <tr>
                                <td>联系电话：</td>
                                <td style="padding-left: 50px;">
                                    <input disabled="disabled" class="easyui-validatebox" type="text" id="linknumber" data-options="required:true" style="width: 800px;" placeholder="请输入联系电话，多个电话请用，隔开" /></td>
                            </tr>
                            <tr>
                                <td>房屋剩余年限：</td>
                                <td style="padding-left: 50px;">
                                    <input disabled="disabled" class="easyui-validatebox" type="text" id="overyears" data-options="required:true" style="width: 800px;" placeholder="请输入房屋剩余年限" /></td>
                            </tr>
                            <tr>
                                <td>贷款额度（万元）：</td>
                                <td style="padding-left: 50px;">
                                    <input disabled="disabled" class="easyui-validatebox" type="text" id="Quota" data-options="required:true" style="width: 800px;" placeholder="请输入贷款额度，单位为万元" /></td>
                            </tr>
                            <tr>
                                <td>房屋坐落：</td>
                                <td style="padding-left: 50px;">
                                    <input disabled="disabled" class="easyui-validatebox" type="text" id="houseaddr" data-options="required:true" style="width: 800px;" placeholder="请输入房屋坐落" /></td>
                            </tr>
                            <tr>
                                <td>房屋用途：</td>
                                <td style="padding-left: 50px;">
                                    <select class="easyui-combobox" style="width: 800px;" id="select1" disabled="disabled"  data-options="editable:false">
                                        <%=DictionaryBD()%>
                                    </select>
                                </td>
                            </tr>
                            <tr>
                                <td>建成年代：</td>
                                <td style="padding-left: 50px;">
                                    <input disabled="disabled" class="easyui-validatebox" type="text" id="startyear" data-options="required:true" style="width: 800px;" placeholder="请输入建成年代" /></td>
                            </tr>
                            <tr>
                                <td>建成年代来源：</td>
                                <td style="padding-left: 50px;">
                                    <select class="easyui-combobox" style="width: 800px;" id="select22" disabled="disabled"  data-options="editable:false">
                                        <%=YersBD() %>
                                    </select></td>
                            </tr>
                            <tr>
                                <td>报告类型：</td>
                                <td style="padding-left: 50px;">
                                    <select class="easyui-combobox" style="width: 800px;" id="select3" disabled="disabled"  data-options="editable:false">
                                        <%=BGTypeBD() %>
                                    </select></td>
                            </tr>
                            <tr>
                                <td>评估受理：</td>
                                <td style="padding-left: 50px;">

                                    <input disabled="disabled" class="mm" name="chk_deng" type="checkbox" value="审核评估登记表" />审核评估登记表 
                            <input disabled="disabled" class="mm" name="chk_deng" type="checkbox" value="身份证明" />身份证明 
                            <input disabled="disabled" class="mm" name="chk_deng" type="checkbox" value="房屋权属" />房屋权属 
                            <input disabled="disabled" class="mm" name="chk_deng" type="checkbox" value="网签合同" />网签合同 
                                </td>
                            </tr>
                            <tr>
                                <td>所属部门：</td>
                                <td style="padding-left: 50px;">
                                    <select class="easyui-combobox" style="width: 800px;" id="select4"  data-options="editable:false">
                                        <option>--请选择--</option>
                                        <%=departmentBD()%>
                                    </select></td>
                            </tr>
                            <tr>
                                <td>勘察员：</td>
                                <td style="padding-left: 50px;">
                                    <select class="easyui-combobox" style="width: 800px;" id="select5"  data-options="editable:false">
                                        <option>--请选择--</option>
                                        <%=surveyDB(2)%>
                                    </select></td>
                            </tr>
                            <tr>
                                <td>估价员：</td>
                                <td style="padding-left: 50px;">
                                    <select class="easyui-combobox" style="width: 800px;" id="select6"  data-options="editable:false">
                                        <option>--请选择--</option>
                                        <%=surveyDB(3)%>
                                    </select></td>
                            </tr>
                            <tr>
                                <td>评估通知单出具日期：</td>
                                <td style="padding-left: 50px;">
                                    <input disabled="disabled" class="easyui-tex" type="text" id="riqi" data-options="required:true" style="width: 800px;" placeholder="请输入评估通知单出具日期" /></td>
                            </tr>
                        </table>
                    </div>
                    <div style="text-align: center; padding: 5px">
                       <input type="button" id="UpdateEvaluation" onclick="bind()" />
                        <%--  <a class="easyui-linkbutton" id="UpdateEvaluation" onclick="bind()"></a>--%>                    </div>
                </div>
            </div>
        </div>
    </form>

    <script type="text/javascript" src="../easyui/easyui/1.3.2/jquery-1.8.0.min.js"></script>
    <script type="text/javascript" src="../easyui/easyui/1.3.2/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="../easyui/easyui/1.3.2/locale/easyui-lang-zh_CN.js"></script>
    <script type="text/javascript" src="../easyui/jquery.params.js"></script>



    <script>
        $(function () {
            var state = $.query.get("state");
            if (state == 0) {
                $("#UpdateEvaluation").val("提交");
            }
            if (state > 0) {
                $("#UpdateEvaluation").val("保存");
                if (state > 1) {
                    $("#select4").combobox({ disabled: true })
                    $("#select5").combobox({ disabled: true })
                }
            }
            //获取项目号
            var projectNumber = $.query.get("ke");

            $.ajax({
                type: "post", //要用post方式                 
                url: "LiXiangEdit.aspx/Edit",//方法所在页面和方法名
                data: "{'projectNumber':'" + projectNumber + "'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (data) {
                    var json = eval("(" + data.d + ")");
                    $("#name").val(json.loan_Name);   //借款人姓名
                    $("#idCard").val(json.loan_IdCard);//借款人身份证号
                    $("#telNumber").val(json.loan_TEL);//借款人电话
                    $("#linkmen").val(json.loan_Contacts);//联系人
                    $("#linknumber").val(json.loan_ContactsTEL);  //联系人的联系方式
                    $("#overyears").val(json.surplus_Years);//剩余年限
                    $("#Quota").val(json.basic_Quota);//借款额度
                    $("#houseaddr").val(json.house_Located);//房屋位于
                    $("#select1").combobox('select', json.house_Purpose);//房屋用途
                    $("#startyear").val(json.house_Time);//房屋年代
                    $("#select22").combobox('select', json.yers_Source);//建成年代来源
                    $("#select3").combobox('select', json.presentation_Type);//报告类型


                    $("#select4").combobox('select', json.the_Department);//所属部门
                    $("#select5").combobox('select', json.survey);//勘察员
                    $("#select6").combobox('select', json.evaluation);//评估员
                    $("#riqi").val(json.issue_Time);//出具日期
                    //评估受理复选框反填
                    $(":checkbox").each(function () {
                        var tmpVal = $(this).val();
                        if (json.assessment.indexOf(tmpVal) >= 0) {
                            $(this).attr("checked", true);
                        }
                    })
                }
            });
        })
        //更改评估员
        //$("#UpdateEvaluation").bind('click', function () {
        function bind() {
            //获取项目号
            var projectNumber = $.query.get("ke");
            var state = $.query.get("state");
            var select6 = $("#select6").combobox("getValue");
            var select5 = $("#select5").combobox("getValue");
            var select4 = $("#select4").combobox("getValue");
            $.ajax({
                type: "post",
                url: "LiXiangEdit.aspx/UpdateEvaluation",
                data: "{'projectNumber':'" + projectNumber + "','ID':'" + select6 + "','Bumen':'" + select4 + "','Kancha':'" + select5 + "','State':'" + state + "'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                async: false,
                success: function (obj) {
                    obj = eval(obj)
                    if (obj) {
                        $.messager.alert('变更信息', '评估员变更成功', 'info', function () {
                            parent.addTab("项目立项列表", "/ProjectInitiation/LiXiangList.aspx", "icon-chart-organisation", true);
                        });
                    }
                    else {
                        $.messager.alert('变更信息', '评估员变更失败');
                    }
                }
            })
        }
    </script>
</body>
</html>


